<include file="Common/works/header" />
<include file="Common/works/left_menu" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/xcConfirm.css" />
<script language="javascript" type="text/javascript" src="__PUBLIC__/js/jquery.selectlist.js"></script>
<script type="text/javascript">
	$(function(){
		$('select').selectlist({
			zIndex: 10,
			width: 300,
			height: 40
		});		
	})
</script>
  <div class="right" id="tab1">
    <div class="title">我的API</div>
    <div class="sskt">
      <select id="service-select" class="_api_select_service">
        <option value="-1" <if condition="($selected_service_id neq null)">selected="selected" </if> >选择服务</option>
        <foreach name="service_list" item="service" key="k" >
        <option value="{$service.service_id}" <if condition="($selected_service_id neq null) and ($selected_service_id eq $service['service_id'])">selected="selected"</if>>{$service.service_name}</option>
        </foreach>
      </select>
    </div>
    <div class="certification_list">
      <a data-id="2" class="_tab_list hr" onclick="setTab('con_one_2',this)">已发布</a>
      <a data-id="1" class="_tab_list" onclick="setTab('con_one_1',this)">待审核</a>
      <a data-id="0" class="_tab_list" onclick="setTab('con_one_0',this)">未发布</a>
      <a data-id="3" class="_tab_list" onclick="setTab('con_one_3',this)">审核失败</a>
      <a data-id="4" class="_tab_list" onclick="setTab('con_one_4',this)">已下架</a>
    </div>
    
    
    <div class="api_list _api_list" id="con_one_1" style="">
      <div class="table-top">
        <div class="tab">提交审核时间</div>
        <div class="tab">API名称</div>
        <div class="tab">服务名称</div>
        <div class="tabl">API状态</div>
        <div class="tabr">操作</div>
      </div>
      <!-- 循环开始 -->
      <div id="api_list_published_content"></div>
      
      <script id="api_list_published" type="text/html">
      {{each list as value key}}
        <div class="table-foot _raw_api">
          <div class="tab">{{value.update_time | dateFormat:'yyyy-MM-dd hh:mm:ss'}}</div>
          <div class="tab text-left">
            {{if (value.api_auth_status==2) }}
            <a class="margin-010" href="/apiworks/apiView?service_id={{value.service_id}}&api_id={{value.api_id}}" title="{{value.api_name}}" target="_blank">{{value.api_name}}</a>
            {{else}}
            <a class="margin-010" href="/apiworks/apiLocalview?service_id={{value.service_id}}&api_id={{value.api_id}}" title="{{value.api_name}}" target="_blank">{{value.api_name}}</a>
            {{/if}}
          </div>
          <div class="tab">
          {{if value.s_service_name}}  
            {{value.s_service_name}}
          {{else}}
            {{value.service_name}}
          {{/if}}
          </div>

          <div class="tabl">
            <div class="zt">
              {{if (value.api_auth_status==2) && (value.api_status==1)}}
              <div class="r2 inline-flex">已发布</div>
              {{else if (value.api_auth_status==3) && (value.api_status==0) && (value.src_api_status==1)}}
              <div class="r3 inline-flex _fail_auth_span">
                更新审核失败
                <span class="_child_fail_span">{{value.api_service_auth_fail_cause}}</span>
              </div>
              {{else if (value.api_auth_status==3) && (value.api_status==0) && (value.src_api_status==2)}}
              <div class="r3 inline-flex _fail_auth_span">
                重新上架审核失败
                <span class="_child_fail_span">{{value.api_service_auth_fail_cause}}</span>
              </div>
              {{else if (value.api_auth_status==1) && (value.api_status==0) && (value.src_api_status==1)}}
              <!-- 更新待审核时，有可能会存在已发布状态显示  -->
                {{if api_type==2}}
                  <div class="r2 inline-flex">已发布</div>
                {{else}}
                  <div class="r1 inline-flex">更新待审核</div>
                {{/if}}

              {{else if (value.api_auth_status==1) && (value.api_status==0) && (value.src_api_status==2)}}
              <div class="r1 inline-flex">重新上架待审核</div>
              {{else if (value.api_auth_status==1) && (value.api_status==0)}}
              <div class="r1 inline-flex">新增待审核</div>
              
              {{else if (value.api_auth_status==0) && (value.api_status==0)}}
              <div class="r1 inline-flex">新增未发布</div>
              {{else if (value.api_auth_status==3) && (value.api_status==0)}}
              <div class="r3 inline-flex _fail_auth_span">
                新增审核失败<span class="_child_fail_span">{{value.api_service_auth_fail_cause}}</span>
              </div>
              {{else}}
              <div class="r4 inline-flex">已下架</div>
              {{/if}}
            </div>
          </div>

          <div class="tabr">
            <div class="inline-flex">
            {{if (value.api_auth_status==2) && (value.api_status==1)}}
            <!-- ====已发布====== -->
            <!-- <a href="/apiworks/apiUpdate.html?api_id={{value.api_id}}" target="_blank" class="_api_update" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" data-apistatus="{{value.sapi_status}}" data-api-auth-status="{{value.sapi_auth_status}}" title="更新">更新</a> -->

              <a href="#" class="_api_update" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" data-apistatus="{{value.sapi_status}}" data-api-auth-status="{{value.sapi_auth_status}}" title="更新">更新</a>
              <a href="javascript:void(-1);return false;" class="_api_setdown" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" data-api-status="{{value.sapi_status}}" data-api-name="{{value.api_name}}" data-service-name="{{value.service_name}}" data-api-name-en="{{value.api_name_en}}" data-service-name-en="{{value.service_name_en}}" title="申请下架">申请下架</a>
            {{else if (value.api_auth_status!=1)&&(value.api_status==0)}}
            <!-- =====未发布及审核失败====== -->
              <a href="/apiworks/apiEdit.html?api_id={{value.api_id}}&service_id={{value.service_id}}&auth={{value.api_auth_status}}" target="_blank" title="编辑">编辑</a>
              <a href="javascript:void(0);" class="_api_publish" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" data-srcstatus="{{value.src_api_status}}" title="发布API">发布API</a>
              {{if value.src_api_status==1}}
              <!-- ====发布更新失败时=== -->
              <a href="javascript:void(0);" class="_api_callback" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}"  data-api-status="{{value.api_status}}" data-api-auth-status="{{value.api_auth_status}}" data-src-api-status="{{value.src_api_status}}" title="撤回审核" data-type="four">删除更新</a>

              {{else if (value.src_api_status==1) || (value.src_api_status==2) }}
                <a href="javascript:void(0);" title="删除" data-serviceid="{{value.service_id}}" data-id="{{value.api_id}}" class="_api_list_del">删除</a>
              {{/if}}
            {{else if (value.api_auth_status==1)&&(value.api_status==0)}}
            <!-- ===待审核,待审核中可能存在 已发布状态============ -->
              {{if api_type==2}}
                <a href="javascript:void(-1);return false;" class="_api_setdown" data-serviceid="{{value.service_id}}" data-api-name="{{value.api_name}}" data-service-name="{{value.service_name}}" data-apiid="{{value.api_id}}"  data-api-status="1" title="申请下架">申请下架</a>
              {{else}}
                {{if value.src_api_status==1}}
                <a href="javascript:void(0);" class="_api_callback" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" data-api-status="{{value.api_status}}" data-api-auth-status="{{value.api_auth_status}}"  data-src-api-status="{{value.src_api_status}}" title="撤回更新" data-type="two">撤回更新</a>
                {{else if value.src_api_status==2}}
                <a href="javascript:void(0);" class="_api_callback" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" data-api-status="{{value.api_status}}" data-api-auth-status="{{value.api_auth_status}}"  data-src-api-status="{{value.src_api_status}}" title="撤回重新上架" data-type="three">撤回重新上架</a>
                {{else if (value.src_api_status==0) }}
                <a href="javascript:void(0);" class="_api_callback" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}"  data-api-status="{{value.api_status}}" data-api-auth-status="{{value.api_auth_status}}" data-src-api-status="{{value.src_api_status}}" title="撤回审核" data-type="one">撤回审核</a>
                {{/if}}
              {{/if}}

            {{else}}
            <!-- ===已下架===== -->
            <a href="/apiworks/apiEdit.html?api_id={{value.api_id}}&service_id={{value.service_id}}&auth={{value.api_auth_status}}" target="_blank" title="编辑">编辑</a>
            <a href="javascript:void(0);" title="删除" data-serviceid="{{value.service_id}}" data-id="{{value.api_id}}" class="_api_list_del">删除</a>
            <a href="javascript:void(0);" class="_api_resetup" data-serviceid="{{value.service_id}}" data-apiid="{{value.api_id}}" title="重新上架">重新上架</a>
            {{/if}}
			</div>
          </div>
        </div>
      {{/each}}
      </script>
      
      <div class="page fr _page_info" style="margin:20px"></div>

      <div class="cls"></div>
    </div>
    
   <!-- <include file="Common/footer_simple" /> -->
  </div>
</div>

<div id="delBox" class="grantdiv">
  <div class="hz">
    <div class="hztop"><a href="javascript:void(0)" title="关闭窗口" class="close_btn _close_btn" ><img src="__PUBLIC__/home/images/no.png" /></a></div>
    <div class="hzcp">
      <p>确定删除该API?</p>
    </div>
    <div class="mydiv-foot" style=" width:250px; margin:0 auto"><a href="javascript:void(0)" class="smthree fl _close_btn">取消</a><a class="smtwo fr _confirm_btn">确认</a></div>
  </div>
</div>

<div id="xiajiaBox" class="grantdiv">
  <div class="hz">
    <div class="hztop"><a style="float:right; margin-right:20px;" href="javascript:void(0)" title="关闭窗口" class="close_btn _close_btn"  id="xiajia_btn"><img src="__PUBLIC__/home/images/no.png" /></a></div>
    <div class="hzcp">
      <!-- <textarea name="ss" class="off" autocomplete="on"  maxlength="250" placeholder="请输入下架理由"  /></textarea> -->
      <p>确定下架该API?</p>
    </div>
   <!--  <div class="mydiv-foot" style=" width:250px; float:right; margin-right:10px; height:50px"><a href="javascript:void(0)" class="smthree fl xiajia_btn _close_btn" id="xiajia_btn">取消</a><a class="smtwo fr _confirm_down_btn">确定</a></div>
   --> 
    <div class="mydiv-foot" style=" width:250px; margin:0 auto"><a href="javascript:void(0)" class="smthree fl _close_btn">取消</a><a class="smtwo fr _confirm_down_btn">确认</a></div>
    <!-- <div class="cls"></div> -->
  </div>
</div>

<div id="backBox" class="grantdiv">
  <div class="hz">
  <div class="hztop"><a href="javascript:void(0)" title="关闭窗口" class="close_btn _close_btn" ><img src="__PUBLIC__/home/images/no.png" /></a></div>
    <div class="hzcp">
      <p>确定要<font class="_callback_one _callback_p">撤回审核</font><font class="_callback_two hide _callback_p">撤回更新</font><font class="_callback_three hide _callback_p">撤回重新上架</font><font class="_callback_four hide _callback_p">删除更新</font>API吗？</p>
    </div>
    <div class="mydiv-foot" style=" width:250px; margin:0 auto"><a href="javascript:void(0)" class="smthree fl _close_btn">取消</a><a class="smtwo fr _confirm_back_btn">确定</a></div>
  </div>
</div>

<div id="upBox" class="grantdiv">
  <div class="hz">
    <div class="hztop"><a style="float:right; margin-right:20px;" href="javascript:void(0)" title="关闭窗口" class="close_btn _close_btn" id="xiajia_btn"><img src="__PUBLIC__/home/images/no.png" /></a></div>
    <div class="hzcp">
      <p>确定重新上架该API?</p>
    </div>
    <div class="mydiv-foot" style=" width:250px; margin:0 auto"><a href="javascript:void(0)" class="smthree fl _close_btn">取消</a><a class="smtwo fr _confirm_up_btn">确认</a></div>
    <!-- <div class="mydiv-foot" style=" width:250px; float:right; margin-right:10px; height:50px"><a href="javascript:void(0)" class="smthree fl xiajia_btn _close_btn" id="xiajia_btn">取消</a><a class="smtwo fr _confirm_up_btn">确定</a></div>
    --> <div class="cls"></div>
  </div>
</div>

<div id="publishBox" class="grantdiv">
  <div class="hz">
  <div class="hztop"><a href="javascript:void(0)" title="关闭窗口" class="close_btn _close_btn" ><img src="__PUBLIC__/home/images/no.png" /></a></div>
    <div class="hzcp">
      <p>确定要发布该API？</p>
    </div>
    <div class="mydiv-foot" style=" width:250px; margin:0 auto"><a href="javascript:void(0)" class="smthree fl _close_btn">取消</a><a class="smtwo fr _confirm_publish_btn">确定</a></div>
  </div>
</div>

<input type="hidden" class="_api_type_value" value="2" /><!--默认为已发布-->
<input type="hidden" class="_api_service_id_value" value="-1" /><!--默认为服务编号-->
<input type="hidden" class="_apilist_service_id" value="{$selected_service_id}" /> <!-- 某服务下列表 -->
<input type="hidden" class="_apilist_api_type" value="{$api_type}" />
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/artTemplate.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/xcConfirm.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/apilist.js"></script>
<script>
function show(obj,id) {    
    var objDiv = $("#"+id+"");
    $(objDiv).css("display","block");
}
function hide(obj,id) {
    var objDiv = $("#"+id+"");
    $(objDiv).css("display", "none");
}

</script>
</body>
</html>